<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
use thinkcms\auth\Auth;
use think\Cookie;
use app\common\model\SystemSet;

class Login extends Controller
{
/*     
    public function login($where=array(),$user='',$password='') {
    	
    	if(input('post.')){
	    
    		$user=input('post.nickname');
    	
    		$password=input('post.password');
    		
    		$where=array('nickname'=>$user,'password'=>md5($password));

    		$qurey=Db::name('admin_user')->where($where)->find();
    		
    		if($qurey['uid']){
    	
    			session('user',$qurey['nickname']);
    	
    			session('uid',$qurey['uid']);

    			$auth = new Auth();
    	
    			$auth::login(session('uid'),session('user'));
    			
    			Cookie::set('user',$qurey['nickname'],24*3600*3);
    			Cookie::set('uid',$qurey['uid'],24*3600*3);
    			 
    			$system = new SystemSet();
    			$ip=get_ip();
    			$name = $_COOKIE['user'];
    			$system->CaoZuoJl('1','后台登录',time(),$ip,$name);
    		}else{
    		    $this->error('账号不存在或密码错误!');
    		}
    	
    		$this->success('登录成功!','/admin/index/index');
    		
    	}else{
            return $this->fetch();
    	}
    }
     */
    public function logout(){
    	cookie('user',null);
    	cookie('uid',null);
    	cookie(null);
    	$auth = new Auth();
    	$auth::logout();
    	$this->redirect('index/Kkk/qazkhjbj');
    }
    
}